<template>
  <div class="app-container">
    <el-card>
      <el-form :model="queryBankList" :inline="true" label-width="68px">
        <el-form-item label="仓库">
          <el-select clearable v-model="queryBankList.stoCode" style="width: 100%;">
            <el-option v-for="(item, index) in selectStrock" :key="index" :value="item.sto_code" :label="item.sto_name">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" icon="el-icon-search" @click="bankQuery">查询</el-button>
          <el-button type="danger" icon="el-icon-refresh" @click="clearAll">重置</el-button>
        </el-form-item>
      </el-form>
    </el-card>
    <el-card>
      <el-table :data="getBankList" border height="605px" :default-sort = "{prop: 'date', order: 'descending'}">
        <el-table-column prop="code" label="商品编码" align="center"></el-table-column>
        <el-table-column prop="cwarehouse_name" label="仓库名称" align="center"></el-table-column>
        <el-table-column prop="sto_unit_id" label="货位ID" align="center"></el-table-column>
        <el-table-column prop="vbatchcode" label="批号" sortable align="center"></el-table-column>
        <el-table-column prop="vvendbatchcode" label="供应商批号" align="center"></el-table-column>
        <el-table-column prop="name" label="商品名称" align="center"></el-table-column>
        <el-table-column prop="materialspec" label="商品规格" align="center"></el-table-column>
        <el-table-column prop="sku_num" label="实际数量" align="center"></el-table-column>
        <el-table-column prop="freeze_num" label="冻结数量" align="center"></el-table-column>
      </el-table>
    </el-card>
  </div>
</template>

<script>
  import {
    getStoUnitQuery,
    findStatisticSto,
    getStatisticStoUnit
  } from "@/api/report/index.js";
  export default {
    data() {
      return {
        queryBankList: {
          stoCode: '',
        },
        selectStrock: [],
        getBankList: []
      }
    },
    created() {
      this.getBank();
      this.getCodeList();
      let param = {
        stoAreaCode:'10',
        stoUnitCode:''
      }
      getStatisticStoUnit(param).then(res=>{
        console.log(res,11111);
      })
    },
    methods: {
      bankQuery() {
        this.getBank();
      },
      //获取所有仓库
      getCodeList() {
        let param = {
          stoCode: ''
        }
        findStatisticSto(param).then(res => {
          this.selectStrock = res.data;
        })
      },
      //table内容
      getBank() {
        let param = {
          stoCode: '',
          unitIdValue: 2,
          unitId: ''
        }
        getStoUnitQuery(param).then(res => {
          this.getBankList = res.data;
        })
      },
      clearAll() {
        this.queryBankList.name = '';
      }
    }
  }
</script>

<style scoped lang="scss">
  .app-container {
    padding: 20px;
  }

  .el-card {
    margin-bottom: 20px;
  }

  .el-pagination {
    float: right;
    margin: 20px;
  }
</style>
